/*
 * Copyright (c) 1989 - 1999 Microsoft Corporation
 */
#pragma once

//
// Debug definitions
//
#define DBG_ANY         ((UINT64)-1)
#define DBG_SESSION     (1ull << 0)
#define DBG_FOPEN       (1ull << 1)
#define DBG_FUNC_END    (1ull << 2)
#define DBG_IOCTL       (1ull << 3)
#define DBG_TRACE_FUNC  (1ull << 4)
#define DBG_FWRITE      (1ull << 5)
#define DBG_FILEINFO    (1ull << 6)
#define DBG_READDIR     (1ull << 7)
#define DBG_FILEEA      (1ull << 8)
#define DBG_FREAD       (1ull << 9)
#define DBG_VIOFS       (1ull << 10)
#define DBG_FUSE_CACHE  (1ull << 11)
#define DBG_RDR_CACHE   (1ull << 12)

#define DBG_TRACE       3
#define DBG_INFO        2
#define DBG_WARN        1
#define DBG_ERR         0


extern UINT64  g_hwFsDebugMask;
extern LONG   g_hwFsDebugLevel;

#undef RxDbgTrace
#undef RxDbgPrint

#define HWFS_DBG_PRINT(Level, Component, c) \
    if ((g_hwFsDebugLevel >= (Level)) || (g_hwFsDebugMask & (Component))) { \
        DbgPrint c; \
    }

#define HWFS_DBG_ENDFUNC(Status) \
    if (g_hwFsDebugMask & DBG_FUNC_END) \
        DbgPrint("<< "__FUNCTION__" : %08lx\n", Status)

#define RxTraceEnter(func)
#define RxTraceLeave(status)

#define RX_VERIFY(f)  if ((f)) ; else ASSERT(1==0)

//
//  Set or Validate equal
//
#define SET_OR_VALIDATE(x, y, f)                  \
        if ((f)) (x) = (y); else ASSERT((x) == (y))

//
//  RXCONTEXT data - mini-rdr context stored for async completions
//  NOTE: sizeof this struct should be == MRX_CONTEXT_SIZE !!
//

typedef struct _HWFS_COMPLETION_CONTEXT {
    ULONG       Information; // IoStatus.Information
    NTSTATUS    Status; // IoStatus.Status
    ULONG       OutstandingIOs; // Num of Outstanding I/Os
    ULONG       IoType; // I/O type
} HWFS_COMPLETION_CONTEXT, *PHWFS_COMPLETION_CONTEXT;

#define IO_TYPE_SYNCHRONOUS     0x00000001
#define IO_TYPE_ASYNC           0x00000010
